﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AffinityORMLibrary.DataTypes;
using System.Reflection;

namespace AffinityORMLibrary.DataLayer.Utility
{
    class SQLHelper
    {
        public static string CreateWhereClause(DataBase domain)
        {
            if (domain.ComparerRows.Count > 0)
            {
                string whereclause = " WHERE ";

                foreach (SelectionComparerRow row in domain.ComparerRows)
                {
                    whereclause += (row.Property.Name + SQLComparer.SelectionCriteriaComparerStringValue(row.Comparer) + "'" + row.Value + "' ");
                }

                return whereclause;
            }

            return string.Empty;
        }
    }
}
